package app

import (
	"jtdevice/app/access"
	"jtdevice/app/db"
	"jtdevice/app/hook"
	"log"
)

// Run 启动
func Run() error {
	log.Printf("hook sender %s", hook.Sender.Run())
	if err := db.Run(); err == nil {
		hook.Receiver.Run(false) //使用订阅方式入库
	}
	return access.Run()
}

// Shutdown 停止
func Shutdown() error {
	hook.Sender.Release()
	hook.Receiver.Release()
	access.Shutdown()
	return nil
}
